<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="util.*" %>
<%@ page import="model.*" %>
<%@ page import="control.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
		<%
		//此页面将session中取出的图片名 和 表单传来的描述信息，作为 新增图片 一起存入数据库。
		request.setCharacterEncoding("UTF-8");
		//ArrayList<Integer> pic_idlist=(ArrayList<Integer>)session.getAttribute("pic_idlist");
	 List l = (List)session.getAttribute("photolist");
	 List picnews = new ArrayList<PicNews>();
	 for(int i=0;i<l.size();i++){
		 PicNews pn = new PicNews();
		 pn.setPic((String)l.get(i));
		 pn.setContent(ParamUtil.getString(request,(String)l.get(i)));
		 picnews.add(pn);
	 }
	 if(PicNewsControl.AddPicNews(picnews)){
		 System.out.print("Yes");
		 %>
		 <script>
		 alert("添加成功！");
		 window.location.href ="pic.jsp"; 
		 </script>
		 <%
		 session.removeAttribute("photolist");
	 }else{
		 %>
		 <script>
		 alert("添加失败！");
		 history.go(-1)；
		 </script>
		 <%
	 }
  		%>
</body>
</html>